package test13;// write your code here
import java.util.*;

public class Main{
    
    public static void main(String[]args) {

        Scanner sc = new Scanner(System.in);
        while( sc.hasNextInt()) {
            int n = sc.nextInt();
            int arr[] = new int[n];
            int brr[] = new int[n];
            int k =0;
            int len = 0;
        
            for(int i=0;i<n;i++) {
                arr[i] = sc.nextInt();
            }
            for(int i=0;i<arr.length;i++) {
                k=0;
                int m = arr[i];
                brr[k++] = arr[i];
                int bmax = brr[0];
                for(int j=i+1;j<n;j++) {
                    if (arr[j] > m) {
                        brr[k++] = arr[j];
                        bmax = arr[j];
                        m = arr[j];

                    } else {
                        if (arr[j] > arr[i]) {
                            brr[k - 1] = arr[j];
                            m = arr[j];
                        }
                    }
                }
                if( k > len) {
                    len = k;
                }
            }
             System.out.println(len);
        }
       
        
    }
}